home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / Apple II / Essentials / MPW IIGS Interfaces / PIIGSIncludes / PasLibIntf.p < prev    next >
Encoding:
Text File  |  1991-10-28  |  5.7 KB  |  235 lines  |  [TEXT/MPS ]

  1. {*-------------------------------------------------------------------------------*
  2.  |                                                                                 |
  3.  |                          <<< Pascal Library Interface >>>                         |
  4.  |                                                                                 |
  5.  |                        Copyright Apple Computer, Inc. 1986                      |
  6.  |                               All rights reserved.                              |
  7.  |                                                                                 |
  8.  *-------------------------------------------------------------------------------*}
  9.  
  10. {
  11.  Interface to the Pascal I/O and Memory Manager Library.
  12.  Built-in procedure and function declarations are marked with
  13.  the (* *) comment characters
  14. }
  15.  
  16. UNIT PASLIBIntf;
  17.  
  18.   INTERFACE
  19.  
  20.     TYPE
  21.       PASCALPOINTER = ^INTEGER; { Universal POINTER type }
  22.       PASCALFILE = FILE; { Universal FILE type }
  23. (*
  24.  *      PASCALBLOCK =    { Universal block of chars }
  25.  *            PACKED ARRAY [0..511] OF CHAR;
  26.  *)
  27.  
  28.     CONST
  29.       { <StdIO.h> PLSetVBuf styles }
  30.       _IOFBF = $00; { File buffering }
  31.       _IOLBF = $40; { Line buffering }
  32.       _IONBF = $04; { No buffering }
  33.  
  34. {
  35.  Mac Pascal heap management
  36. }
  37.  
  38.     PROCEDURE PLHeapInit(sizepheap: LONGINT; heapDelta: LONGINT;
  39.                          memerrProc: UNIV PASCALPOINTER; allowNonCont: BOOLEAN;
  40.                          forDispose: BOOLEAN);
  41.  
  42.     PROCEDURE PLSetNonCont(allowNonCont: BOOLEAN);
  43.  
  44.     PROCEDURE PLSetMErrProc(memerrProc: UNIV PASCALPOINTER);
  45.  
  46.     PROCEDURE PLSetHeapType(forDispose: BOOLEAN);
  47.  
  48.     PROCEDURE PLSetHeapCheck(DoIt: BOOLEAN);
  49.  
  50. {
  51.  File I/O
  52. }
  53.  
  54. (*
  55.  *      PROCEDURE
  56.  *        RESET(VAR fvar:  UNIV PASCALFILE; OPT fname: STRING);
  57.  *        BUILTIN;
  58.  *
  59.  *      PROCEDURE
  60.  *        REWRITE(VAR fvar: UNIV PASCALFILE; OPT fname: STRING);
  61.  *        BUILTIN;
  62.  *
  63.  *      PROCEDURE
  64.  *        OPEN(VAR fvar:    UNIV PASCALFILE; fname: STRING);
  65.  *        BUILTIN;
  66.  *)
  67.  
  68.     PROCEDURE PLSetVBuf(VAR fvar: TEXT; buffer: UNIV PASCALPOINTER;
  69.                         style: INTEGER; bufsize: INTEGER);
  70. (*
  71.  *      FUNCTION
  72.  *        BLOCKREAD(
  73.  *          VAR fvar: FILE;
  74.  *          VAR buffer: UNIV PASCALBLOCK;
  75.  *          nBlocks: INTEGER;
  76.  *          OPT stBlock:INTEGER
  77.  *        ):
  78.  *        INTEGER;
  79.  *        BUILTIN;
  80.  *
  81.  *      FUNCTION
  82.  *        BLOCKWRITE(
  83.  *          VAR fvar: FILE;
  84.  *          VAR buffer: UNIV PASCALBLOCK;
  85.  *          nBlocks: INTEGER;
  86.  *          OPT stBlock:INTEGER
  87.  *        ):
  88.  *        INTEGER;
  89.  *        BUILTIN;
  90.  *
  91.  *      FUNCTION
  92.  *        BYTEREAD(
  93.  *          VAR fvar: FILE;
  94.  *          VAR buffer: UNIV PASCALBLOCK;
  95.  *          nBytes:  LONGINT;
  96.  *          OPT stByte: LONGINT
  97.  *        ):
  98.  *        LONGINT;
  99.  *        BUILTIN;
  100.  *
  101.  *      FUNCTION
  102.  *        BYTEWRITE(
  103.  *          VAR fvar: FILE;
  104.  *          VAR buffer: UNIV PASCALBLOCK;
  105.  *          nBytes:  LONGINT;
  106.  *          OPT stByte: LONGINT
  107.  *        ):
  108.  *        LONGINT;
  109.  *        BUILTIN;
  110.  *
  111.  *      FUNCTION
  112.  *        EOF(OPT VAR fvar: UNIV PASCALFILE):
  113.  *        BOOLEAN;
  114.  *        BUILTIN;
  115.  *
  116.  *      FUNCTION
  117.  *        EOLN(OPT VAR fvar: TEXT):
  118.  *        BOOLEAN;
  119.  *        BUILTIN;
  120.  *
  121.  *      PROCEDURE
  122.  *        READ(VAR fvar: TEXT; OPT EXPR_LIST);
  123.  *        BUILTIN;
  124.  *
  125.  *      PROCEDURE
  126.  *        READLN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
  127.  *        BUILTIN;
  128.  *
  129.  *      PROCEDURE
  130.  *        WRITE(VAR fvar: TEXT; OPT EXPR_LIST);
  131.  *        BUILTIN;
  132.  *
  133.  *      PROCEDURE
  134.  *        WRITELN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
  135.  *        BUILTIN;
  136.  *
  137.  *      PROCEDURE
  138.  *        GET(VAR fvar: UNIV PASCALFILE);
  139.  *        BUILTIN;
  140.  *
  141.  *      PROCEDURE
  142.  *        PUT(VAR fvar: UNIV PASCALFILE);
  143.  *        BUILTIN;
  144.  *
  145.  *      PROCEDURE
  146.  *        SEEK(VAR fvar: UNIV PASCALFILE; recno: LONGINT);
  147.  *        BUILTIN;
  148.  *)
  149.  
  150.     FUNCTION PLFilePos(VAR fvar: UNIV PASCALFILE): LONGINT;
  151.  
  152.     PROCEDURE PLFlush(VAR fvar: TEXT);
  153.  
  154.     PROCEDURE PLCrunch(VAR fvar: UNIV PASCALFILE);
  155. {
  156.  Directory operations.
  157. }
  158.  
  159.     PROCEDURE PLPurge(fname: STRING);
  160.  
  161.     PROCEDURE PLRename(oldFname, newFname: STRING);
  162.     
  163.  
  164.  
  165. FUNCTION  BAND4(long1, long2: LongInt): LongInt;  {these calls are only here temporarilty }
  166. FUNCTION  BOR4 (long1, long2: LongInt): LongInt;
  167. FUNCTION  BXOR4(long1, long2: LongInt): LongInt;
  168. FUNCTION  BNOT4(long1:        LongInt): LongInt;
  169.  
  170. FUNCTION  BSL4  (long1: LongInt; count: INTEGER): LongInt;
  171. FUNCTION  BSR4  (long1: LongInt; count: INTEGER): LongInt;
  172. FUNCTION  BRotL4(long1: LongInt; count: INTEGER): LongInt;
  173. FUNCTION  BRotR4(long1: LongInt; count: INTEGER): LongInt;
  174.  
  175. FUNCTION  BTst4(    long1: LongInt; pos: INTEGER): BOOLEAN;
  176. PROCEDURE BClr4(VAR long1: LongInt; pos: INTEGER);
  177. PROCEDURE BSet4(VAR long1: LongInt; pos: INTEGER);
  178.  
  179. (* JAM 91.08.18 *)
  180. (* The following INLINE byte-level routines emit code that
  181.     accesses only the specified byte, and no adjacent bytes
  182.     on either side.  This is an absolute requirement for
  183.     manipulating softswitches on the Apple IIGS.  "Normal"
  184.     code emitted by the Pascal code generator tends to
  185.     access nothing smaller than a word at a time, for
  186.     efficiency's sake, packing and unpacking individual bytes
  187.     as necessary.  But sometimes, the somewhat larger, slower
  188.     code here is preferrable, because, especially in
  189.     softswitch manipulation, mere access to bytes other than
  190.     the one you want can leave the machine in bizarre states.
  191. *)
  192. FUNCTION Peek(AddrOfByte: LONGINT): INTEGER;
  193. (* Return as an INTEGER, the value of the byte at location
  194.     given by AddrOfByte.  This routine accesses the single
  195.     byte at the given address only, by narrowing acc-mem
  196.     width to 8-bits before the read operation.
  197. *)
  198. (* 16 bytes, 41 or 44 cycles depending on SP value at entry *)
  199.     INLINE
  200.         (* PHD *)                $0B,
  201.         (* TSC *)                $3B,
  202.         (* TCD *)                $5B,
  203.         (* SEP    #$20 *)            $E2, $20,
  204.         (* LDA    [AddrOfByte] *)    $A7, $03,
  205.         (* STA    Peek *)            $85, $07,
  206.         (* STZ    Peek+1 *)        $64, $08,
  207.         (* REP    #$20 *)            $C2, $20,
  208.         (* PLD *)                $2B,
  209.         (* PLA *)                $68,
  210.         (* PLA *)                $68
  211.         ;
  212.  
  213. PROCEDURE Poke(AddrOfByte: LONGINT; ValueToPoke: INTEGER);
  214. (* Put the lower byte of ValueToPoke into the RAM byte-location
  215.     specified by AddrOfByte.  This routine accesses the
  216.     single byte at the given address only, by narrowing the
  217.     acc-mem width to 8-bits before the write.
  218. *)
  219. (* 15 bytes, 43 or 45 cycles depending on SP value at entry *)
  220.     INLINE
  221.         (* PHD *)                $0B,
  222.         (* TSC *)                $3B,
  223.         (* TCD *)                $5B,
  224.         (* SEP    #$20 *)            $E2, $20,
  225.         (* LDA    ValueToPoke *)    $A5, $03,
  226.         (* STA    [AddrOfByte] *)    $87, $07,
  227.         (* REP    #$20 *)            $C2, $20,
  228.         (* PLD *)                $2B,
  229.         (* PLA *)                $68,
  230.         (* PLA *)                $68,
  231.         (* PLA *)                $68
  232.         ;
  233.  
  234. END.
  235.